package com.chao.yyks.modular.studentMsg.controller;

import com.alibaba.fastjson.JSONObject;
import com.chao.common.util.log.Inter;
import com.chao.common.util.reaction.PageList;
import com.chao.yyks.modular.studentMsg.bean.EnStudentMsg;
import com.chao.yyks.modular.studentMsg.service.EnStudentMsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 学生留言Controller
 * chao
 * 2024-10-17
 */
@RestController
@RequestMapping("/enStudentMsg")
public class EnStudentMsgController {

	/**
	 * 学生留言Service
	 */
	@Autowired
	private EnStudentMsgService enStudentMsgService;

	/**
	 * 新增学生留言
	 */
	@Inter("ESM_ADD_01")
	@RequestMapping(method = RequestMethod.POST, value = "insertEnStudentMsg")
	public void insertEnStudentMsg(@RequestBody EnStudentMsg enStudentMsg){
		enStudentMsgService.insertEnStudentMsg(enStudentMsg);
	}

	/**
	 * 修改学生留言
	 */
	@Inter("ESM_EDT_01")
	@RequestMapping(method = RequestMethod.POST, value = "updateEnStudentMsg")
	public void updateEnStudentMsg(@RequestBody EnStudentMsg enStudentMsg){
		enStudentMsgService.updateEnStudentMsg(enStudentMsg);
	}

	/**
	 * 物理删除学生留言
	 */
	@Inter("ESM_DEL_02")
	@RequestMapping(method = RequestMethod.POST, value = "deleteDataEnStudentMsg")
	public void deleteDataEnStudentMsg(@RequestBody EnStudentMsg enStudentMsg){
		enStudentMsgService.deleteDataEnStudentMsg(enStudentMsg.getId());
	}

	/**
	 * 查询学生留言详情
	 */
	@Inter("ESM_SEL_01")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnStudentMsgById")
	public EnStudentMsg selectEnStudentMsgById(String id){
		return enStudentMsgService.selectEnStudentMsgById(id);
	}

	/**
	 * 查询学生留言列表
	 */
	@Inter("ESM_SEL_02")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnStudentMsgByList")
	public PageList<EnStudentMsg> selectEnStudentMsgByList(@RequestParam Map<String,Object> map){
		return enStudentMsgService.selectEnStudentMsgByList(new JSONObject(map));
	}

}